<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
				xmlns:ui="http://java.sun.com/jsf/facelets"
				xmlns:h="http://java.sun.com/jsf/html"
				xmlns:f="http://java.sun.com/jsf/core"
				xmlns:s="http://jboss.com/products/seam/taglib"
				xmlns:rich="http://richfaces.org/rich"
				template="../template.xhtml">

	<!-- content -->
	<ui:define name="content">
		<h:messages globalOnly="true" styleClass="message" id="globalMessages" />
		<h:form>
		
		<s:button action="#{supermercadoBean.prepareCreate}" id="novo1" value="Novo supermercado" />
		<br/><br/>
		
		<rich:panel>
			<f:facet name="header">Supermercados</f:facet>
			<div class="results" id="contatoList">
			<rich:dataTable 
				id="supermercadoList" var="supermercado" 
				value="#{supermercadoList}" rows="15">
				<f:facet name="header">
					<rich:datascroller for="supermercadoList" maxPages="20"
						id="supermercadoListScroller" style="align: right"
						renderIfSinglePage="false"
						bypassUpdates="true" pageIndexVar="pageIndex" pagesVar="pages">
					</rich:datascroller>
				</f:facet>
				
				<rich:column sortBy="#{supermercado.id}">
					<f:facet name="header">ID</f:facet>
            		#{supermercado.id}
				</rich:column>
				<rich:column width="200px" sortBy="#{supermercado.descricao}">
					<f:facet name="header">Descrição</f:facet>
            		#{supermercado.descricao}
	        	</rich:column>
				<rich:column>
					<f:facet name="header">Ação</f:facet>
					<s:link id="editar" action="update"><h:graphicImage alt="Editar" title="Editar" url="../img/edit.png" style="border:0; margin:1px;" /></s:link>&nbsp;&nbsp;
					<s:link id="remover" action="delete"><h:graphicImage alt="Remover" title="Remover" url="../img/delete.png" style="border:0; margin:1px;" /></s:link>
				</rich:column>
				
				<f:facet name="footer">Total: #{supermercadoList.size}</f:facet>
			</rich:dataTable>
			</div>
		</rich:panel>
		<br />
		<s:button action="#{supermercadoBean.prepareCreate}" id="novo2" value="Novo supermercado" />
		</h:form>
	</ui:define>
</ui:composition>
